"use strict"
/**
 * @param {import("egg").Application} app
 */
module.exports = app => {
	const Sequelize = app.Sequelize
	const sequelize = app.model
	// sequelize.
	let AdditionProp = sequelize.define("additionProp", {
		prop_name: {
			type: Sequelize.STRING(20)
		},
		price: {
			type: Sequelize.DOUBLE
		},
		cost_type: {
			type: Sequelize.SMALLINT,
		},
		tool_type: {
			type: Sequelize.SMALLINT,
		},
		detail: {
			comment: " // 1: 金币加成, 2: 自动化, 3: 时间减少",
			type: Sequelize.STRING,
			defaultValue: "{}",
			get() {
				let v = this.getDataValue("detail")
				return v && JSON.parse(v)
			},
			set(val) {
				this.setDataValue("detail", JSON.stringify(val))
			}
		},
		desc: {
			type: Sequelize.STRING,
		},
		map_id: {
			type: Sequelize.STRING,
		},
		aid: {
			type: Sequelize.INTEGER,
			comment: " 哪个小程序的道具 暂时为空"
		}
	}, {
		timestamps: false,
		tableName: "empire_addition_prop"
	})

	return AdditionProp
}